<?php
/**
 * Created by PhpStorm.
 * User: 程序猴
 * QQ: 505413
 * Date: 2018/3/30
 * Time: 21:46
 */

namespace app\index\controller;
use app\admin\model\ConfigModel;
use think\Controller;
use think\Db;
class Base extends Controller
{
    public function _initialize()
    {
        //如果是响应式的删除掉这个 如果pc和手机端是2个模块不要动这个
        if(isMobile()){
            $this->redirect('mobile/index');
        }
        $configModel = new ConfigModel();
        $list = $configModel->getAllConfig();
        $config = [];
        foreach ($list as $k => $v) {
            $config[trim($v['name'])] = $v['value'];

        }
        if($config['web_site_close'] != '1' ){
            $this->error('站点未开启','http://' . $_SERVER['HTTP_HOST']);
        }
    }
}